package cn.han.oop;

import java.io.*;
import java.util.Arrays;
import java.util.Random;

public class AA {

    public static void main(String[] args) {
        try {
            BufferedReader isr = new BufferedReader(
                    new InputStreamReader(
                            new BufferedInputStream(
                                    new FileInputStream("1.txt"))));
            String[] a6 = isr.readLine().split("，");
            System.out.println(a6.length);
            String[] s1 = new String[5];
            int a = new Random().nextInt(21);
            for (int j = 0; j <5; j++) {
                s1[j] = a6[a];
                for (int i = a; i < a6.length - 1; i++) {
                    a6[i] = a6[i + 1];
                }
                a6 = Arrays.copyOf(a6, a6.length - 1);
                a =new Random().nextInt(21-j-1);
            }
            System.out.println(Arrays.toString(s1));
            BufferedWriter bos
                    = new BufferedWriter(
                    new OutputStreamWriter(
                            new FileOutputStream("2.txt")));
            bos.write(Arrays.toString(a6));
            bos.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }}

